Skip to content

PR: Cherry-pick common-v8 from upstream#22

Merged
miccy merged 20 commits intomainfrom
merge/common-v8-04-02-2026
Feb 5, 2026
Merged

PR: Cherry-pick common-v8 from upstream#22
miccy merged 20 commits intomainfrom
merge/common-v8-04-02-2026

Conversation

@miccy
Copy link
Copy Markdown
Contributor

@miccy miccy commented Feb 4, 2026

Description

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring

Checklist

  • Code follows project style guidelines
  • Tests pass locally (bun run check)
  • Documentation updated (if applicable)
  • No secrets or sensitive data included

Related Issues

Summary by CodeRabbit

  • New Features

    • Added a standalone, schema-scoped query builder for creating typed queries without an instance; examples updated to use it.
  • Breaking Changes

    • Instance-based query creation removed — migrate existing code to the new per‑schema builder.
  • Documentation

    • Expanded Test‑Driven Development guidance with detailed Vitest/browser testing examples and workflows.
  • Chores

    • Switched test tooling to Vitest, adjusted test configs/scripts, and bumped several dev/type/package versions.

steida and others added 11 commits February 4, 2026 13:09
Introduce a root vitest.config.ts and split package test configs into unit and browser projects (packages/common/vitest.unit.config.ts, packages/common/vitest.browser.config.ts). Remove the old combined common vitest config and migrate per-package coverage/test settings into the central config. Update package.json scripts to run Vitest from the repo root, remove per-package Vitest deps where appropriate, and add browser/playwright-related devDeps at the root. Adjust tsconfigs (add root tsconfig.json and include vitest.*.config.ts in packages/common) and simplify turbo.json task entries. Also add a README link to the Vitest VS Code extension.
Replace the brief Test-driven development note with an expanded TDD section that explains how to run tests, test file locations, and filtering by test name. Add subsections on test structure, type testing (expectTypeOf), and inline snapshot usage with Vitest code examples. Remove the previous Vitest filtering CLI snippets and some commit-message examples to streamline the guidance and surface more actionable testing patterns for contributors.
Rename vitest.config.ts → vitest.config.mts (switch to .mts/ESM), update tsconfig include to reference vitest.config.mts, and add a new "scripts" test project in the Vitest config to include tests matching scripts/**/*.test.mts. Also simplify package.json "verify" script by removing the generic "pnpm test" step.
Introduce a standalone createQueryBuilder(Schema) to build typed Kysely queries without an Evolu instance. The createQuery implementation was moved into packages/common/src/local-first/Schema.ts and exported from index.ts; Evolu.createQuery was removed from the Evolu interface/instance. Updated usages across playgrounds to call createQuery(...) (created via createQueryBuilder) and adjusted types/docs in Query.ts. Added a changeset noting the API migration and guidance to replace evolu.createQuery with createQueryBuilder(Schema).
@miccy miccy requested a review from Copilot February 4, 2026 23:21
@miccy miccy added upstream Needs cherry-pick or merge from upstream feat New feature or request labels Feb 4, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 4, 2026

📝 Walkthrough

Walkthrough

Adds a standalone createQueryBuilder API and removes createQuery from Evolu instances; reorganizes Vitest configs into root and per-package projects; updates test scripts and devDependencies; updates examples to use schema-scoped query builders and performs dependency/tooling bumps.

Changes

Cohort / File(s) Summary
Core API & Types
packages/common/src/local-first/Schema.ts, packages/common/src/index.ts, packages/common/src/local-first/Evolu.ts, packages/common/src/local-first/Query.ts
Add and export createQueryBuilder and related CreateQuery surface in Schema.ts and index; remove createQuery from the Evolu instance/public surface and update imports/exports and examples.
Schema Implementation
packages/common/src/local-first/Schema.ts
Implement createQueryBuilder, guard against SQL mutations via isSqlMutation, serialize queries, and adjust ensureDbSchema local mutation handling.
Examples & Consumers
apps/web/src/app/.../EvoluFullExample.tsx, apps/web/src/app/.../EvoluMultitenantExample.tsx, examples/**/src/**, examples/angular-vite-pwa/src/app/schema.ts, examples/*/components/*
Replace evolu.createQuery(...) with schema-scoped createQuery = createQueryBuilder(Schema) or Evolu.createQueryBuilder(Schema) across examples and update imports/exports where needed.
Testing Configs (Vitest)
vitest.config.mts, packages/common/vitest.unit.config.ts, packages/common/vitest.browser.config.ts, packages/*/vitest.config.ts, packages/common/vitest.config.ts (removed)
Add root vitest.config.mts, add per-package project configs, convert configs from defineConfigdefineProject, add unit/browser split configs and remove the legacy combined packages/common/vitest.config.ts.
Scripts & Orchestration
package.json, turbo.json, tsconfig.json, packages/*/package.json, packages/common/package.json, packages/nodejs/package.json, packages/web/package.json
Move test orchestration to root Vitest, remove per-package test scripts and Turbo test tasks, update test/test:coverage/test:watch scripts, and rework devDependency placements.
Manifests & Tooling Bumps
biome.json, .ai/..., AGENTS.md, examples/*/package.json, packages/*/package.json
Bump tooling versions (Biome 2.3.13→2.3.14, turbo, webpack), update @types/react and various example package versions, reorganize devDependencies, and add Vitest browser/coverage packages at root.
Tests, Docs & Minor Edits
packages/common/test/local-first/Protocol.test.ts, .github/copilot-instructions.md, README.md, packages/common/src/Error.ts, .changeset/create-query-builder.md, scripts/typedoc-plugin-evolu.test.mts
Formatting and snapshot updates in tests; expanded TDD/testing docs; small README/comment edits; add changeset describing the createQueryBuilder public API.
Config Additions/Removals
packages/common/vitest.config.ts (removed), packages/common/vitest.unit.config.ts (added), vitest.config.mts (added), tsconfig.json (added)
Remove legacy combined config, add focused per-project configs and a root vitest config, and add a tsconfig for vitest config typing.

Sequence Diagram(s)

sequenceDiagram
    participant App as Example App
    participant QBFactory as createQueryBuilder(Schema)
    participant Compiler as Query Compiler
    participant DB as Database

    App->>QBFactory: createQueryBuilder(Schema) [once]
    QBFactory->>QBFactory: return createQuery function

    rect rgba(100, 200, 150, 0.5)
        Note over App,Compiler: Old Pattern (instance-bound)
        App->>App: evolu.createQuery((db) => db.selectFrom(todos))
        App->>Compiler: compile query
        Compiler->>DB: execute
    end

    rect rgba(150, 150, 200, 0.5)
        Note over App,QBFactory: New Pattern (standalone, reusable)
        App->>QBFactory: const todosQuery = createQuery((db) => db.selectFrom(todos))
        QBFactory->>Compiler: compile query
        Compiler->>DB: execute
        App->>QBFactory: const projectsQuery = createQuery((db) => db.selectFrom(projects))
        QBFactory->>Compiler: compile query
        Compiler->>DB: execute
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

🐰 I built a builder in the glade,
Queries hop free, no instance made,
Tests rearranged and configs pruned,
Versions nudged and docs attuned,
I nibble code and bound with pride.


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR cherry-picks changes from the upstream common-v8 branch, implementing a major refactoring of the testing infrastructure and introducing a breaking API change for query creation.

Changes:

  • Centralized Vitest configuration at the repository root with workspace support, removing package-level test scripts
  • Introduced createQueryBuilder as a standalone function, replacing the evolu.createQuery method (breaking change)
  • Updated dependencies including Biome (2.3.14), Kysely (0.28.11), Turbo (2.8.3), and various React type definitions

Reviewed changes

Copilot reviewed 40 out of 42 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
vitest.config.mts New root-level Vitest workspace configuration
tsconfig.json New root TypeScript config for vitest.config.mts
turbo.json Removed test-related tasks (now handled by root vitest)
package.json Centralized test commands to use vitest directly
packages/common/vitest.*.config.ts Split vitest config into separate unit and browser configs
packages/common/src/local-first/Schema.ts Added createQueryBuilder function
packages/common/src/local-first/Evolu.ts Removed createQuery method from Evolu interface
packages/common/src/index.ts Exported createQueryBuilder
packages/*/vitest.config.ts Changed from defineConfig to defineProject
packages/*/package.json Removed test scripts, updated dependencies
apps/web playgrounds Updated to use createQueryBuilder (partial)
.changeset/create-query-builder.md Major version changeset for breaking API change

miccy and others added 2 commits February 5, 2026 00:39
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Miccy <code@miccy.dev>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Miccy <code@miccy.dev>
Copy link
Copy Markdown

Copilot AI commented Feb 4, 2026

@miccy I've opened a new pull request, #23, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Copy Markdown

Copilot AI commented Feb 4, 2026

@miccy I've opened a new pull request, #24, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 3 commits February 5, 2026 04:52
* Initial plan

* Revert EvoluMinimalExample.tsx to working state from 13fab62

Co-authored-by: miccy <9729864+miccy@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: miccy <9729864+miccy@users.noreply.github.com>
* Initial plan

* Update all examples to use createQueryBuilder instead of evolu.createQuery

Co-authored-by: miccy <9729864+miccy@users.noreply.github.com>

* Fix CI: add build:docs before typedoc-plugin tests in verify script

Co-authored-by: miccy <9729864+miccy@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: miccy <9729864+miccy@users.noreply.github.com>
Signed-off-by: Miccy <support@miccy.dev>
Copy link
Copy Markdown
Contributor Author

@miccy miccy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Zkontroluj ještě proč neprošlo CI

Copy link
Copy Markdown

Copilot AI commented Feb 5, 2026

@miccy I've opened a new pull request, #27, to work on those changes. Once the pull request is ready, I'll request review from you.

@miccy miccy merged commit 3cb6e4d into main Feb 5, 2026
5 checks passed
@miccy miccy deleted the merge/common-v8-04-02-2026 branch February 10, 2026 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat New feature or request upstream Needs cherry-pick or merge from upstream

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants